package ${package_pojo};
<#if swagger==true>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
import javax.persistence.*;
import java.io.Serializable;
<#list typeSet as set>
import ${set};
</#list>
<#if lombok=="true">
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
</#if>
<#if lombok!="true">
import java.util.Objects;
</#if>

/**
 * @Author huanmin
 */

<#if lombok=="true">
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
</#if>
<#if swagger==true>
@ApiModel(value = "${Table}${pojoSuffix}",description = "${TableComment}")
</#if>
@Table(name="${TableName}")
public class ${Table}${pojoSuffix} implements Serializable{
    private static final long serialVersionUID = 1L;
<#list models as model>
	<#if swagger==true>
		<#if model.desc??!=false && model.desc?length gt 0>
	@ApiModelProperty(value = "${model.desc?trim}",required = ${model.isNull})
		<#else>
	@ApiModelProperty(value = "没有字段描述",required = ${model.isNull})
		</#if>
	</#if>
	<#if model.id==true>
	@Id
	<#if model.identity=='YES'>
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	</#if>
	</#if>
	@Column(name = "${model.column}")
	private ${model.simpleType} ${model.name};
</#list>
	<#if swagger==true>
	@ApiModelProperty(value = "条件实体",required = false)
	</#if>
    private	Condition condition;


<#if lombok!="true">

	<#list models as model>

	public ${model.simpleType} get${model.upperName}() {
			return ${model.name};
	}

	public void set${model.upperName}(${model.simpleType} ${model.name}) {
			this.${model.name} = ${model.name};
	}
	</#list>

	public void setCondition(Condition condition) {
		this.condition = condition;
	}
	public void getCondition(Condition condition) {
		this.condition = condition;
	}

	@Override
	public String toString() {

			return"${Table}${pojoSuffix}:{" +
				<#list models as model>
					"${model.name}=" + this.${model.name}+"," +
					<#if !model_has_next>
					"${model.name}=" + this.${model.name} +
					</#if>
				</#list>
				,"condition="+this.condition
			'}';
	}

   // 重写equals
	@Override
	public boolean equals(Object o) {
				if (this == o) {
				return true;
				}
				if (o == null || getClass() != o.getClass()) {
				return false;
				}
				${Table}${pojoSuffix} ${table}${pojoSuffix} = (${Table}${pojoSuffix}) o;
		  return <#list models as model>
						Objects.equals(${model.name}, ${table}${pojoSuffix} .${model.name}) &&
					<#if !model_has_next>
						Objects.equals(${model.name}, ${table}${pojoSuffix} .${model.name}) ;
					</#if>
					&& Objects.equals(condition, ${table}${pojoSuffix} .condition);
				</#list>
	}
	// 重写hashCode
	@Override
	public int hashCode() {
				return Objects.hash(
						<#list models as model>
							${model.name},
							<#if !model_has_next>
							${model.name}
							</#if>
							,condition
						</#list>
			);
	}

</#if>



}
